<?php 
include '../Connections/KRAPPERCON.php';
include('../Connections/Accesos.php');
?>

<form method="get" id="frm_regcom" target="_blank" >
<div>
<input type="button" onclick='regComprasXls()' value="Exportar" />
<input type="hidden" value="export" name="oper" id="oper"/>
<input type="radio" name="rc_opt" id="rc_xls" checked="checked" value="rc_xls" />&nbsp;Formato Excel&nbsp;&nbsp;<input type="radio" name="rc_opt" id="rc_pdf" value="rc_pdf" />
&nbsp;Formato PDF&nbsp;
</div>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr class="noView">
    <td>Fecha Factura:</td>
    <td colspan="3">
      <input name="t_rc_fini" value="<?php echo $hoy;?>" class="tcal clsReq" type="text" id="t_rc_fini" size="15" maxlength="10" />
&nbsp;
    a 
    &nbsp;
    <input name="t_rc_ffin" value="<?php echo $ultDia;?>" class="tcal clsReq" type="text" id="t_rc_ffin" size="15" maxlength="10" />  </td>
  </tr>
  <tr>
    <td>Periodo :</td>
    <td colspan="3"><select name="cb_per_rc" id="cb_per_rc">
    <?php 
	include ("../Query_Min/getPeriodos.php");
	?>
    </select>
    </td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
<script type="text/javascript">
function regComprasXls(){
	if (GEBI('rc_xls').checked){
	GEBI('frm_regcom').action = "Consultas/Opers/queryRegCom.php";
	GEBI('oper').value = 'export';
	}
	if (GEBI('rc_pdf').checked){
	GEBI('frm_regcom').action = "Consultas/Opers/queryRegComPDF.php";
	GEBI('oper').value = 'pdf';
	}
	var per = GEBI('cb_per_rc').value;
	var ann = per.substring(0,4);
	var mes = per.substring(5);
	if (pInt(mes)<10){
	mes = '0'+mes;
	}
	GEBI('t_rc_fini').value = ann+"-"+mes+"-01";
	GEBI('t_rc_ffin').value = ann+"-"+mes+"-"+(daysInMonth(mes,ann));	
	//	var fini = GEBI('t_rc_fini').value;
//	var ffin = GEBI('t_rc_ffin').value;
	GEBI('frm_regcom').submit();
	//var win = window.open('Consultas/Opers/queryRegCom.php?oper=export&fini='+fini+'&ffin='+ffin);
	}
</script>
